<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <search-form
      :showSuperButton="false"
      :showAddButton="false"
      :showColumnNumber="8"
      :exportFileName="$t('process.moOrderDetailList.exportFileName')"
    >
      <a-col :xl="4" :lg="7" :md="8" :sm="24">
        <a-form-item label="工单号">
          <a-input placeholder="请输入工单号" v-model="queryParam.moNum" allowClear></a-input>
        </a-form-item>
      </a-col>
      <a-col :xl="4" :lg="7" :md="8" :sm="24">
        <a-form-item label="工序">
          <a-input placeholder="请输入工序" v-model="queryParam.processName" allowClear></a-input>
        </a-form-item>
      </a-col>
      <a-col :xl="4" :lg="7" :md="8" :sm="24">
        <a-form-item :label="$t('drawingNo')">
          <a-input :placeholder="$t('pleaseInput') + $t('drawingNo')" v-model="queryParam.dwgNo" allowClear></a-input>
        </a-form-item>
      </a-col>
    </search-form>
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> {{ $t('selectedTxt') }}
        <a style="font-weight: 600">{{ selectedRowKeys.length }}</a
        >{{ $t('itemTxt') }}
        <a style="margin-left: 24px" @click="onClearSelected">{{ $t('button.ClearTxt') }}</a>
      </div>
      <div class="fivs-all-box">
        <div class="fivs-all-contain">
          <fmsx-table
            ref="table"
            size="middle"
            :scroll="{ x: true }"
            bordered
            rowKey="id"
            :columns="columns"
            :dataSource="dataSource"
            :pagination="ipagination"
            :loading="loading"
            :rowSelection="{
              selectedRowKeys: selectedRowKeys,
              onChange: onSelectChange
            }"
            class="j-table-force-nowrap"
            @change="handleTableChange"
          >
          </fmsx-table>
        </div>
      </div>
    </div>
  </a-card>
</template>

<script>
import '@/assets/less/TableExpand.less'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'

export default {
  mixins: [JeecgListMixin],
  name: 'inventoryLoss',
  data () {
    return {
      disableMixinCreated: true,

      dateRange: [],
      description: '盘亏列表',
      // 表头
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: 'center',
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: '工单号',
          align: 'center',
          dataIndex: 'moNum'
        },
        {
          title: '客户代码',
          align: 'center',
          dataIndex: 'custCode'
        },
        {
          title: '工序名称',
          align: 'center',
          dataIndex: 'processName'
        },
        {
          title: '工序编码',
          align: 'center',
          dataIndex: 'processId'
        },
        {
          title: '图号',
          align: 'center',
          dataIndex: 'dwgNo',
          customRender: (text, row, index) => {
            if (text && text.length > 0) {
              //let url = window._CONFIG['domianURL'] + '/base/annex/file/download/' + userpath
              let url = '/#/mes/other/pdf?drawNum=' + row.dwgNo + '&drawRev=' + row.rev
              return (
                <a href={url} target='_blank'>
                  {text}
                </a>
              )
            }
          }
        },
        {
          title: '版本',
          align: 'center',
          dataIndex: 'rev'
        },
        {
          title: '盘点库存数量',
          align: 'center',
          dataIndex: 'storageQuantity'
        },
        {
          title: '盘亏数量',
          align: 'center',
          dataIndex: 'exceptionQuantity'
        },
        {
          title: '生产数量',
          align: 'center',
          dataIndex: 'productionQuantity'
        },
        {
          title: '订单数量',
          align: 'center',
          dataIndex: 'orderQuantity'
        },

        {
          title: this.$t('optionsBy'),
          align: 'center',
          dataIndex: 'updateBy'
        },
        {
          title: this.$t('optionsTime'),
          align: 'center',
          dataIndex: 'updateTime'
        }
      ],
      url: {
        list: '/prod-pre/make/makeStocktakingException/list',
        exportXlsUrl: '/prod-pre/make/makeStocktakingException/exportXls'
      }
    }
  },
  created () {
    this.$set(this.queryParam, 'exceptionType', '1')
    this.loadData()
  }
}
</script>
